//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize("Ofast","unroll-loops","inline")
#include<bits/stdc++.h>
#define ll long long
//#define int ll
#define pb push_back
using namespace std;
const int N=5e5+10,M=1e6+10,mod=998244353;
const int Mx=1e9+10; 
bool vis[N];
struct Seg{
	vector<int> s[N<<2],t[N<<2];
	inline void upd(int rt,int l,int r,int ql,int qr,int i){
		s[rt].pb(i);if(ql<=l&&r<=qr) return t[rt].pb(i);
		int mid=(l+r)>>1;
		if(ql<=mid) upd(rt<<1,l,mid,ql,qr,i);
		if(qr>mid) upd(rt<<1|1,mid+1,r,ql,qr,i);
	}
	int qry(int rt,int l,int r,int ql,int qr){
		while(!s[rt].empty()&&vis[s[rt].back()]) s[rt].pop_back();
		while(!t[rt].empty()&&vis[t[rt].back()]) t[rt].pop_back();
		if(ql<=l&&r<=qr) return (!s[rt].empty()?s[rt].back():0);
		int mid=(l+r)>>1,res=(!t[rt].empty()?t[rt].back():0);
		if(ql<=mid) res=max(res,qry(rt<<1,l,mid,ql,qr));
		if(qr>mid) res=max(res,qry(rt<<1|1,mid+1,r,ql,qr));
		return res;
	}
}tr;
struct Node{int a,b,c,d;}p[N];
inline bool cmp(Node x,Node y){return x.a<y.a;}
int H,W,n;
signed main(){
	freopen("grid.in","r",stdin);
	freopen("grid.out","w",stdout);
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>H>>W>>n;
	for(int i=1;i<=n;i++) cin>>p[i].a>>p[i].b,p[i].c=p[i].a,p[i].d=p[i].b;
	sort(p+1,p+n+1,cmp);
	for(int i=1,id,res,a,b,d;i<=n;i++){
		while(1){
			id=0;
			if(!id){
				a=p[i].a,b=max(1,p[i].b-2),d=min(W,p[i].d+2);
				res=tr.qry(1,1,W,b,d);
				if(p[res].c>=a) id=res;
			}
			if(!id){
				a=max(1,p[i].a-1),b=max(1,p[i].b-1),d=min(W,p[i].d+1);
				res=tr.qry(1,1,W,b,d);
				if(p[res].c>=a) id=res;
			}
			if(!id){
				a=max(1,p[i].a-2),b=p[i].b,d=p[i].d;
				res=tr.qry(1,1,W,b,d);
				if(p[res].c>=a) id=res;
			}
			if(!id) break;
			p[i].a=min(p[i].a,p[id].a),p[i].b=min(p[i].b,p[id].b);
			p[i].c=max(p[i].c,p[id].c),p[i].d=max(p[i].d,p[id].d);
			p[id]=(Node){0,0,-1,-1};vis[id]=1;
		}
		tr.upd(1,1,W,p[i].b,p[i].d,i);
	}
	ll ans=0;
	for(int i=1;i<=n;i++) ans+=1ll*(p[i].c-p[i].a+1)*(p[i].d-p[i].b+1);
	cout<<ans<<'\n';
	return 0;
}
